package com.example.mydemo.controller;

import com.example.mydemo.domain.User;
import com.example.mydemo.response.ResponseData;
import com.example.mydemo.response.ResponseDataUtil;
import com.example.mydemo.response.ResultEnums;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class TestController {

    @PostMapping("/api/test")
    public ResponseData test(@Validated @RequestBody User user) {
        return ResponseDataUtil.buildSuccess( "110","哈哈我终于成功了") ;
    }

    @GetMapping("/api/data")
    public ResponseData data() {
        return ResponseDataUtil.buildSuccess(new User());
    }
}